package ModelLayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class AddressBookTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class AddressBookTest
{
    private ModelLayer.AddressBook addressB1;
    private ModelLayer.Person person1;

    

    /**
     * Default constructor for test class AddressBookTest
     */
    public AddressBookTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
        addressB1 = new ModelLayer.AddressBook();
        person1 = new ModelLayer.Person(1, "1", "1", "1", "1", "1");
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }


    @Test
    public void testAdd()
    {
        ModelLayer.Person person1 = new ModelLayer.Person(1, "1", "1", "1", "1", "1");
        addressB1.addPerson(person1);
        assertSame(person1, addressB1.getPerson(1));
    }

    @Test
    public void test0Delete()
    {
        ModelLayer.Person person1 = new ModelLayer.Person(1, "1", "1", "1", "1", "1");
        addressB1.deletePerson(person1);
        java.util.ArrayList<ModelLayer.Person> arrayLis1 = addressB1.getPersons();
        assertSame(arrayLis1, arrayLis1);
    }

    @Test
    public void test1Get()
    {
        addressB1.addPerson(person1);
        assertSame(person1, addressB1.getPerson(1));
        java.util.ArrayList<ModelLayer.Person> arrayLis1 = addressB1.getPersons();
        assertSame(arrayLis1, arrayLis1);
    }

    @Test
    public void testManyGet()
    {
        addressB1.addPerson(person1);
        ModelLayer.Person person2 = new ModelLayer.Person(2, "2", "2", "2", "2", "2");
        addressB1.addPerson(person2);
        assertSame(person2, addressB1.getPerson(2));
        java.util.ArrayList<ModelLayer.Person> arrayLis1 = addressB1.getPersons();
        assertSame(arrayLis1, arrayLis1);
    }
}





